<template>
<div>
    <Table border :columns="tableCol" :data="tableData" :loading='loading'></Table>
    <div style="float: right;margin-top:10px;">
        <Page
            :total="tableTotal"
            :current="1"
            show-sizer
            show-total
            transfer
            @on-change="changePage"
            @on-page-size-change="changeSizePage"
        ></Page>
    </div>
</div>
</template>
<script>
export default {
    props:{
        tableCol:Array,
        requestUrl:String,
        params:Object
    },
    data(){
        return {
            postData:{},
            tableData:[],
            tableTotal:0,
            loading:false
        }
    },
    created(){
        this.postData = this.params
        this.getData()
    },
    watch:{
        params(){
            this.postData = this.params
            this.getData()
        }
    },
    methods:{
        getData(){
            this.loading = true
            this.$http.post(this.requestUrl,this.postData).then(res=>{
                this.loading = false
                if(res.status==200){
					if(res.data.code==200){
						this.tableData = res.data.data.rows
						this.tableTotal = res.data.data.total
					}
                    
                }
            })
        },
        changePage(page){
            this.postData.pageNo = page
            this.getData()
        },
        changeSizePage(size){
            this.postData.pageSize = size
            this.getData()
        }
    }
}
</script>
<style scoped>

</style>